package controllers

import play.mvc._
trait Secure {
self:Controller =>
  
  @Before
  def checkSecurity = {
    session("username") match {
      case Some(username) => Continue
      case None           => Forbidden //Unauthorized
    }
  }
  
  def isLogedIn:Boolean = {
    ( session("username").isDefined && session("usertheme").isDefined && session("userfont").isDefined )
  }
  
  def logedUserName = {
    session("username").get
  }
}
